

<!DOCTYPE html>
<html lang="zh-CN" data-default-color-scheme=auto>



<head>
  <meta charset="UTF-8">
  <link rel="apple-touch-icon" sizes="76x76" href="/img/fluid.png">
  <link rel="icon" href="/img/fluid.png">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=5.0, shrink-to-fit=no">
  <meta http-equiv="x-ua-compatible" content="ie=edge">
  
  <meta name="theme-color" content="#2f4154">
  <meta name="author" content="John Doe">
  <meta name="keywords" content="">
  
    <meta name="description" content="Docker-Hadoop集群@[toc] 1. Hadoop完全分布式集群步骤总结 本篇博文主要是1-6的步骤。   更新apt ——APT是Advanced Packaging Tool的缩写，是一款强大的包管理工具，也可以称作机制，通过终端安装软件一般是使用apt instll 命令     安装vim  —— 文本编辑器，是编辑环境变量以及配置文件最常用的文本编辑器     安装sshd">
<meta property="og:type" content="article">
<meta property="og:title" content="【Hadoop】基于Docker搭建集群环境">
<meta property="og:url" content="http://example.com/2021/10/13/%E3%80%90Hadoop%E3%80%91%E5%9F%BA%E4%BA%8EDocker%E6%90%AD%E5%BB%BA%E9%9B%86%E7%BE%A4%E7%8E%AF%E5%A2%83/index.html">
<meta property="og:site_name" content="Hexo">
<meta property="og:description" content="Docker-Hadoop集群@[toc] 1. Hadoop完全分布式集群步骤总结 本篇博文主要是1-6的步骤。   更新apt ——APT是Advanced Packaging Tool的缩写，是一款强大的包管理工具，也可以称作机制，通过终端安装软件一般是使用apt instll 命令     安装vim  —— 文本编辑器，是编辑环境变量以及配置文件最常用的文本编辑器     安装sshd">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://img-blog.csdnimg.cn/b49db21b5c0c4c73b4a2a0d300bd2a85.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/58c28257b8da4f4f987ef308aab845a2.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/94ea34f4053143339cb08f647c128e6c.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/cb8e5881e55344dcac60bf3c0f7a184c.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/f165ae27ff1640deabb3be131eb49dab.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/164b9e56e67746928c10249d0b87a934.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/da3105705d664b52b70dd9a9971b1596.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/3f5dd681f1254bb4bbeff1026537d645.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/6ad7581a85814ffc9d6b35c3853905eb.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/817d7428a10641408daab8eaf103caf3.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/fe10c45c33924f7c8dbc29e676bc541f.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/ce551221e65b49eabf2f873efdfc7b1d.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/9d920867455f41659aebda265a6c2f62.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/4a7cc54a286d4e2586c4b7a8b32fdd48.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/2e4a2b35ba3f490a935844094c84e081.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/e7fd749249af43ce8d2fd568d68c67e8.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/c1f7631d627d461c83742f871a10a752.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/30fd247800de48d995c81788cc5a4b23.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/0c8526aea2af422ba16f63cafcd6ff3b.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/afe8071ec85a46f781e11bfd0550fadd.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/ce601a02dff4457cade1656d6bc42632.png">
<meta property="og:image" content="https://img-blog.csdnimg.cn/894d5b9dd1d549a18d3640bc3553cac5.png">
<meta property="article:published_time" content="2021-10-13T01:49:23.000Z">
<meta property="article:modified_time" content="2022-08-22T15:41:38.462Z">
<meta property="article:author" content="John Doe">
<meta property="article:tag" content="Docker">
<meta property="article:tag" content="Hadoop">
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:image" content="https://img-blog.csdnimg.cn/b49db21b5c0c4c73b4a2a0d300bd2a85.png">
  
  
  
  <title>【Hadoop】基于Docker搭建集群环境 - Hexo</title>

  <link  rel="stylesheet" href="https://lib.baomitu.com/twitter-bootstrap/4.6.1/css/bootstrap.min.css" />



  <link  rel="stylesheet" href="https://lib.baomitu.com/github-markdown-css/4.0.0/github-markdown.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/hint.css/2.7.0/hint.min.css" />

  <link  rel="stylesheet" href="https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.css" />



<!-- 主题依赖的图标库，不要自行修改 -->
<!-- Do not modify the link that theme dependent icons -->

<link rel="stylesheet" href="//at.alicdn.com/t/font_1749284_hj8rtnfg7um.css">



<link rel="stylesheet" href="//at.alicdn.com/t/font_1736178_lbnruvf0jn.css">


<link  rel="stylesheet" href="/css/main.css" />


  <link id="highlight-css" rel="stylesheet" href="/css/highlight.css" />
  
    <link id="highlight-css-dark" rel="stylesheet" href="/css/highlight-dark.css" />
  




  <script id="fluid-configs">
    var Fluid = window.Fluid || {};
    Fluid.ctx = Object.assign({}, Fluid.ctx)
    var CONFIG = {"hostname":"example.com","root":"/","version":"1.9.2","typing":{"enable":true,"typeSpeed":70,"cursorChar":"_","loop":false,"scope":[]},"anchorjs":{"enable":true,"element":"h1,h2,h3,h4,h5,h6","placement":"left","visible":"hover","icon":""},"progressbar":{"enable":true,"height_px":3,"color":"#29d","options":{"showSpinner":false,"trickleSpeed":100}},"code_language":{"enable":true,"default":"TEXT"},"copy_btn":true,"image_caption":{"enable":true},"image_zoom":{"enable":true,"img_url_replace":["",""]},"toc":{"enable":true,"placement":"right","headingSelector":"h1,h2,h3,h4,h5,h6","collapseDepth":0},"lazyload":{"enable":true,"loading_img":"/img/loading.gif","onlypost":false,"offset_factor":2},"web_analytics":{"enable":false,"follow_dnt":true,"baidu":null,"google":null,"gtag":null,"tencent":{"sid":null,"cid":null},"woyaola":null,"cnzz":null,"leancloud":{"app_id":null,"app_key":null,"server_url":null,"path":"window.location.pathname","ignore_local":false}},"search_path":"/local-search.xml"};

    if (CONFIG.web_analytics.follow_dnt) {
      var dntVal = navigator.doNotTrack || window.doNotTrack || navigator.msDoNotTrack;
      Fluid.ctx.dnt = dntVal && (dntVal.startsWith('1') || dntVal.startsWith('yes') || dntVal.startsWith('on'));
    }
  </script>
  <script  src="/js/utils.js" ></script>
  <script  src="/js/color-schema.js" ></script>
  


  
<meta name="generator" content="Hexo 6.2.0"></head>


<body>
  

  <header>
    

<div class="header-inner" style="height: 70vh;">
  <nav id="navbar" class="navbar fixed-top  navbar-expand-lg navbar-dark scrolling-navbar">
  <div class="container">
    <a class="navbar-brand" href="/">
      <strong>尤 Ni&#39;s Blog</strong>
    </a>

    <button id="navbar-toggler-btn" class="navbar-toggler" type="button" data-toggle="collapse"
            data-target="#navbarSupportedContent"
            aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
      <div class="animated-icon"><span></span><span></span><span></span></div>
    </button>

    <!-- Collapsible content -->
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
      <ul class="navbar-nav ml-auto text-center">
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/">
                <i class="iconfont icon-home-fill"></i>
                首页
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/archives/">
                <i class="iconfont icon-archive-fill"></i>
                归档
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/categories/">
                <i class="iconfont icon-category-fill"></i>
                分类
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/tags/">
                <i class="iconfont icon-tags-fill"></i>
                标签
              </a>
            </li>
          
        
          
          
          
          
            <li class="nav-item">
              <a class="nav-link" href="/about/">
                <i class="iconfont icon-user-fill"></i>
                关于
              </a>
            </li>
          
        
        
          <li class="nav-item" id="search-btn">
            <a class="nav-link" target="_self" href="javascript:;" data-toggle="modal" data-target="#modalSearch" aria-label="Search">
              &nbsp;<i class="iconfont icon-search"></i>&nbsp;
            </a>
          </li>
          
        
        
          <li class="nav-item" id="color-toggle-btn">
            <a class="nav-link" target="_self" href="javascript:;" aria-label="Color Toggle">&nbsp;<i
                class="iconfont icon-dark" id="color-toggle-icon"></i>&nbsp;</a>
          </li>
        
      </ul>
    </div>
  </div>
</nav>

  

<div id="banner" class="banner" parallax=true
     style="background: url('/img/default.png') no-repeat center center; background-size: cover;">
  <div class="full-bg-img">
    <div class="mask flex-center" style="background-color: rgba(0, 0, 0, 0.3)">
      <div class="banner-text text-center fade-in-up">
        <div class="h2">
          
            <span id="subtitle" data-typed-text="【Hadoop】基于Docker搭建集群环境"></span>
          
        </div>

        
          
  <div class="mt-3">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-author" aria-hidden="true"></i>
        John Doe
      </span>
    
    
      <span class="post-meta">
        <i class="iconfont icon-date-fill" aria-hidden="true"></i>
        <time datetime="2021-10-13 09:49" pubdate>
          2021年10月13日 上午
        </time>
      </span>
    
  </div>

  <div class="mt-1">
    
      <span class="post-meta mr-2">
        <i class="iconfont icon-chart"></i>
        
          5.6k 字
        
      </span>
    

    
      <span class="post-meta mr-2">
        <i class="iconfont icon-clock-fill"></i>
        
        
        
          47 分钟
        
      </span>
    

    
    
  </div>


        
      </div>

      
    </div>
  </div>
</div>

</div>

  </header>

  <main>
    
      

<div class="container-fluid nopadding-x">
  <div class="row nomargin-x">
    <div class="side-col d-none d-lg-block col-lg-2">
      

    </div>

    <div class="col-lg-8 nopadding-x-md">
      <div class="container nopadding-x-md" id="board-ctn">
        <div id="board">
          <article class="post-content mx-auto">
            <!-- SEO header -->
            <h1 style="display: none">【Hadoop】基于Docker搭建集群环境</h1>
            
              <p class="note note-info">
                
                  
                    本文最后更新于：1 小时前
                  
                
              </p>
            
            
              <div class="markdown-body">
                
                <h1 id="Docker-Hadoop集群"><a href="#Docker-Hadoop集群" class="headerlink" title="Docker-Hadoop集群"></a>Docker-Hadoop集群</h1><p>@[toc]</p>
<h1 id="1-Hadoop完全分布式集群步骤总结"><a href="#1-Hadoop完全分布式集群步骤总结" class="headerlink" title="1. Hadoop完全分布式集群步骤总结"></a>1. Hadoop完全分布式集群步骤总结</h1><hr>
<p>本篇博文主要是1-6的步骤。</p>
<blockquote>
<ol>
<li>更新apt ——APT是Advanced Packaging Tool的缩写，是一款强大的包管理工具，也可以称作机制，通过终端安装软件一般是使用apt instll 命令</li>
</ol>
</blockquote>
<blockquote>
<ol start="2">
<li>安装vim  —— 文本编辑器，是编辑环境变量以及配置文件最常用的文本编辑器</li>
</ol>
</blockquote>
<blockquote>
<ol start="3">
<li>安装sshd —— 无密码登陆服务，用于集群各节点之间的无密码访问</li>
</ol>
</blockquote>
<blockquote>
<ol start="4">
<li>安装JDK —— Hadoop的底层HDFS和MapReduce都是基于Java语言实现的，所以需要JVM环境</li>
</ol>
</blockquote>
<blockquote>
<ol start="5">
<li>下载Hadoop集群相关资源，并设置配置文件</li>
</ol>
</blockquote>
<blockquote>
<ol start="6">
<li>做好以上准备工作后，将当前的容器保存为一个<code>新镜像</code></li>
</ol>
</blockquote>
<blockquote>
<ol start="7">
<li>以新镜像开启所需的节点个数，每个节点作为集群的一个节点</li>
</ol>
</blockquote>
<blockquote>
<ol start="8">
<li>创建容器后，测试ssh是否有效，各节点之间必须支持无密码登陆</li>
</ol>
</blockquote>
<blockquote>
<ol start="9">
<li>配置各节点的 etc&#x2F;hosts 文件，设置主机名与IP之间的映射</li>
</ol>
</blockquote>
<blockquote>
<ol start="10">
<li>在多个节点中挑选一个节点作为Master节点，其他节点则作为Slave节点</li>
</ol>
</blockquote>
<blockquote>
<ol start="11">
<li>在主节点中配置集群的副节点 在主节点中修改Hadoop下的<code>./etc/hadoop/workers</code> （当前是Hadoop 3.x.x版本 ，之前的版本是slave文件）</li>
</ol>
</blockquote>
<blockquote>
<ol start="12">
<li>在主节点启动集群，首次启动需初始化Namenode</li>
</ol>
</blockquote>
<blockquote>
<ol start="13">
<li>JPS查看进程，主节点包括NameNode、SecondaryNamenode、ResourceManager，副节点包括NodeManager和DataNode</li>
</ol>
</blockquote>
<blockquote>
<ol start="14">
<li>在HDFS创建目录，并上传Hadoop下的配置文件，测试运行分布式实例，查询HDFS里的结果文本</li>
</ol>
</blockquote>
<h1 id="2-集群环境前的准备"><a href="#2-集群环境前的准备" class="headerlink" title="2. 集群环境前的准备"></a>2. 集群环境前的准备</h1><hr>
<blockquote>
<p>准备Ubuntu镜像</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo docker pull ubuntu<br></code></pre></td></tr></table></figure>

<blockquote>
<p>创建Docker内部传输文件目录</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo mkdir /usr/local/dockerbuild<br></code></pre></td></tr></table></figure>

<blockquote>
<p>创建容器</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo docker run -it -v /usr/local/dockerbuild:/root/build/ --name pc1 ubuntu<br></code></pre></td></tr></table></figure>

<h2 id="2-1-安装-Vim-更新-APT"><a href="#2-1-安装-Vim-更新-APT" class="headerlink" title="2.1 安装 Vim 更新 APT"></a>2.1 安装 Vim 更新 APT</h2><hr>
<blockquote>
<p>先安装好vim之后再修改镜像源</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs shell">apt-get update<br>apt-get install vim<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/b49db21b5c0c4c73b4a2a0d300bd2a85.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>设置系统镜像源，使用apt-get install 安装软件会更快</p>
<p>参考资料：<a target="_blank" rel="noopener" href="https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.3e221b11KruDiG">https://developer.aliyun.com/mirror/ubuntu?spm=a2c6h.13651102.0.0.3e221b11KruDiG</a></p>
</blockquote>
<p>【1】 备份系统原镜像文件 sources.list后删除原文件</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs shell">cd /etc/apt<br>cp sources.list sources.list.bak<br>rm -rf sources.list<br>vim sources.list<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/58c28257b8da4f4f987ef308aab845a2.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p>【2】创建阿里云镜像源站的sources.list文本文件</p>
<p>创建sources.list 并加入一下内容</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br></pre></td><td class="code"><pre><code class="hljs shell">deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse<br>deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse<br><br>deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse<br>deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse<br><br>deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse<br>deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse<br><br>deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse<br>deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse<br><br>deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse<br>deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse<br></code></pre></td></tr></table></figure>

<p>接着 按 ESC -&gt; 冒号: -&gt; wq 保存退出</p>
<p>【3】 更新APT源</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">apt-get update<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/94ea34f4053143339cb08f647c128e6c.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h2 id="2-2-安装网络配置工具-amp-wget工具"><a href="#2-2-安装网络配置工具-amp-wget工具" class="headerlink" title="2.2 安装网络配置工具 &amp; wget工具"></a>2.2 安装网络配置工具 &amp; wget工具</h2><hr>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs shell">apt-get install net-tools <br><br>apt-get install -y wget<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/cb8e5881e55344dcac60bf3c0f7a184c.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h2 id="2-3-安装-SSH设置无密码登陆"><a href="#2-3-安装-SSH设置无密码登陆" class="headerlink" title="2.3 安装 SSH设置无密码登陆"></a>2.3 安装 SSH设置无密码登陆</h2><hr>
<blockquote>
<p>安装 ssh</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">apt-get install ssh<br></code></pre></td></tr></table></figure>

<p><img src="https://img-blog.csdnimg.cn/f165ae27ff1640deabb3be131eb49dab.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p>选择时区，先选6 亚洲 （两次回车）再选 70 上海</p>
<p><img src="https://img-blog.csdnimg.cn/164b9e56e67746928c10249d0b87a934.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p><img src="https://img-blog.csdnimg.cn/da3105705d664b52b70dd9a9971b1596.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>开启 ssh服务</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">/etc/init.d/ssh start<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/3f5dd681f1254bb4bbeff1026537d645.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>设置系统启动时自动开启ssh服务</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs shell">vim ~/.bashrc<br><span class="hljs-meta prompt_"># </span><span class="language-bash">在最后一行加入下面内容</span><br><span class="hljs-meta prompt_"># </span><span class="language-bash">/etc/init.d/ssh start</span><br><span class="hljs-meta prompt_"># </span><span class="language-bash">:wq保存退出</span><br>source ~/.bashrc<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/6ad7581a85814ffc9d6b35c3853905eb.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>配置无密码登陆服务</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs shell"><span class="hljs-meta prompt_"># </span><span class="language-bash">第一条命令输入后需按多次回车</span><br>ssh-keygen -t rsa <br>cd ~/.ssh<br>cat /root/.ssh/id_rsa.pub &gt;&gt; authorized_keys<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/817d7428a10641408daab8eaf103caf3.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>测试一下 ssh localhost</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br></pre></td><td class="code"><pre><code class="hljs shell">ssh localhost<br><span class="hljs-meta prompt_"># </span><span class="language-bash">输入<span class="hljs-built_in">yes</span>后回车</span><br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/fe10c45c33924f7c8dbc29e676bc541f.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br><img src="https://img-blog.csdnimg.cn/ce551221e65b49eabf2f873efdfc7b1d.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>输入exit 可退出当前的ssh连接模式，接下来进行第二次测试</p>
</blockquote>
<p><img src="https://img-blog.csdnimg.cn/9d920867455f41659aebda265a6c2f62.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p>至此，单个容器的SSH已配置完毕，由于到时候会克隆出多个节点，其中的SSH信息都是相同的，所以可直接互相ssh无密码登陆，如果是<strong>不同的机器</strong>，得通过复制公钥步骤如下：（主节点需提前完成 ssh localhost的操作）</p>
<blockquote>
<p>【1】主节点复制一份公钥到根目录下</p>
<p>在主节点输入下面的命令</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell"><span class="hljs-meta prompt_">&gt;</span><span class="language-bash">scp .ssh/id_rsa.pub root@slave:~/id_rsa_master.pub</span><br></code></pre></td></tr></table></figure>

<p>【2】将主节点根目录下的id_rsa_master.pub 拷贝到 所有子节点的根目录</p>
<p>在子节点输入下面的命令</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">cat ~/id_rsa_master.pub &gt;&gt; .ssh/authorized_key<br></code></pre></td></tr></table></figure>

</blockquote>
<h2 id="2-4-安装-JDK"><a href="#2-4-安装-JDK" class="headerlink" title="2.4 安装 JDK"></a>2.4 安装 JDK</h2><hr>
<blockquote>
<p>从清华大学开源软件镜像站下载JDK，速度比较快</p>
<p>原网址<a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/">https://mirrors.tuna.tsinghua.edu.cn/</a></p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs shell">cd /usr/local<br><br>wget https://mirrors.tuna.tsinghua.edu.cn/AdoptOpenJDK/8/jdk/x64/linux/OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz<br><br>tar -zxvf OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz -C ./<br><br>rm -rf OpenJDK8U-jdk_x64_linux_hotspot_8u302b08.tar.gz<br><br>mv jdk8u302-b08/ jdk8<br></code></pre></td></tr></table></figure>

<p><img src="https://img-blog.csdnimg.cn/4a7cc54a286d4e2586c4b7a8b32fdd48.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p><img src="https://img-blog.csdnimg.cn/2e4a2b35ba3f490a935844094c84e081.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>配置环境变量</p>
<p>添加内容为:</p>
<figure class="highlight sh"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs sh"><span class="hljs-built_in">export</span> JAVA_HOME=/usr/local/jdk8<br><span class="hljs-built_in">export</span> JRE_HOME=<span class="hljs-variable">$&#123;JAVA_HOME&#125;</span>/jre<br><span class="hljs-built_in">export</span> CLASSPATH=.:<span class="hljs-variable">$&#123;JAVA_HOME&#125;</span>/lib:<span class="hljs-variable">$&#123;JRE_HOME&#125;</span>/lib<br><span class="hljs-built_in">export</span> PATH=<span class="hljs-variable">$&#123;JAVA_HOME&#125;</span>/bin:<span class="hljs-variable">$PATH</span><br></code></pre></td></tr></table></figure>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><code class="hljs shell">vim ~/.bashrc<br><span class="hljs-meta prompt_"># </span><span class="language-bash">ESC -&gt; :wq -&gt; 回车 保存退出</span><br>source ~/.bashrc<br>java -version <br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/e7fd749249af43ce8d2fd568d68c67e8.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p><img src="https://img-blog.csdnimg.cn/c1f7631d627d461c83742f871a10a752.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<h2 id="2-5-安装-Mysql"><a href="#2-5-安装-Mysql" class="headerlink" title="2.5 安装 Mysql"></a>2.5 安装 Mysql</h2><hr>
<p>因为Ubuntu20.04 版本默认镜像下载的Mysql版本是8.0版本，其速度比5.7稍微慢一点，所以就安装5.7的版本，但是安装非常麻烦，目前尝试没有可用的镜像源可以安装Mysql5.7， 暂时就用8.x版本吧</p>
<blockquote>
<p>安装 Mysql 8（5.7版本安装时会提示输入密码）</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">apt-get install mysql-server<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/30fd247800de48d995c81788cc5a4b23.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>启动 Mysql 服务（安装后会自动启动，现在手动关闭在打开）</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br></pre></td><td class="code"><pre><code class="hljs shell">service mysql stop<br><br>service mysql start<br><br>netstat -tap | grep mysql<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/0c8526aea2af422ba16f63cafcd6ff3b.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<blockquote>
<p>设置密码（一开始没有密码，直接回车就能登陆）</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br></pre></td><td class="code"><pre><code class="hljs shell">mysql -u root -p<br><br>ALTER USER &#x27;root&#x27;@&#x27;localhost&#x27; IDENTIFIED WITH mysql_native_password BY &#x27;123456&#x27;; <br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/afe8071ec85a46f781e11bfd0550fadd.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p>设置完毕。</p>
<h1 id="3-准备集群必要组件"><a href="#3-准备集群必要组件" class="headerlink" title="3. 准备集群必要组件"></a>3. 准备集群必要组件</h1><hr>
<h2 id="版本说明"><a href="#版本说明" class="headerlink" title="版本说明"></a>版本说明</h2><p>接下来的安装步骤依旧在Docker容器里面进行。</p>
<table>
<thead>
<tr>
<th>组件名</th>
<th>版本号</th>
</tr>
</thead>
<tbody><tr>
<td>Hadoop</td>
<td>3.3.1</td>
</tr>
<tr>
<td>HBase</td>
<td>2.4.6</td>
</tr>
<tr>
<td>Hive</td>
<td>3.1.2</td>
</tr>
<tr>
<td>Kafka</td>
<td>2.8.1</td>
</tr>
<tr>
<td>Flume</td>
<td>1.9.0</td>
</tr>
</tbody></table>
<h2 id="3-1-安装-Hadoop"><a href="#3-1-安装-Hadoop" class="headerlink" title="3.1 安装 Hadoop"></a>3.1 安装 Hadoop</h2><hr>
<blockquote>
<p>国外镜像地址 : <a target="_blank" rel="noopener" href="https://archive.apache.org/dist/hadoop/common/%EF%BC%88%E4%B8%8B%E8%BD%BD%E9%80%9F%E5%BA%A6%E4%BC%9A%E6%AF%94%E8%BE%83%E6%85%A2%EF%BC%89">https://archive.apache.org/dist/hadoop/common/（下载速度会比较慢）</a></p>
<p>国内清华大学镜像地址：<a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/">https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/</a></p>
</blockquote>
<p>我的方法是先在浏览器里访问该网址，找到对应版本的tar包后，复制链接到Ubuntu里通过wget命令下载</p>
<p>接下来以 Hadoop 3.3.1 版本为例</p>
<p><img src="https://img-blog.csdnimg.cn/ce601a02dff4457cade1656d6bc42632.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"></p>
<p>下载、解压、修改文件夹名为hadoop 和 jdk下载步骤一致，暂时不配置环境变量</p>
<p>3.3.1 版本的下载链接为<br><a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-3.3.1/hadoop-3.3.1.tar.gz">https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-3.3.1/hadoop-3.3.1.tar.gz</a></p>
<p>解压后记得删除原压缩包，尽量节省容器空间</p>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs shell">cd /usr/local<br><br>wget https://mirrors.tuna.tsinghua.edu.cn/apache/hadoop/common/hadoop-3.3.1/hadoop-3.3.1.tar.gz<br><br>tar -zxvf hadoop-3.3.1.tar.gz -C ./<br><br>rm -rf hadoop-3.1.3.tar.gz<br><br>mv hadoop-3.3.1 hadoop<br></code></pre></td></tr></table></figure>

<h2 id="3-2-安装-HBase"><a href="#3-2-安装-HBase" class="headerlink" title="3.2 安装 HBase"></a>3.2 安装 HBase</h2><hr>
<blockquote>
<p>清华大学镜像站下载：<a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/">https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/</a></p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs shell">cd /usr/local<br><br>wget https://mirrors.tuna.tsinghua.edu.cn/apache/hbase/2.4.6/hbase-2.4.6-bin.tar.gz<br><br>tar -zxvf hbase-2.4.6-bin.tar.gz -C ./<br><br>rm -rf hbase-2.4.6-bin.tar.gz<br><br>mv hbase-2.4.6 hbase<br></code></pre></td></tr></table></figure>

<h2 id="3-3-安装-Hive"><a href="#3-3-安装-Hive" class="headerlink" title="3.3 安装 Hive"></a>3.3 安装 Hive</h2><hr>
<blockquote>
<p>清华大学镜像站下载：<a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/apache/hive/">https://mirrors.tuna.tsinghua.edu.cn/apache/hive/</a></p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs shell">cd /usr/local<br><br>wget https://mirrors.tuna.tsinghua.edu.cn/apache/hive/hive-3.1.2/apache-hive-3.1.2-bin.tar.gz<br><br>tar -zxvf apache-hive-3.1.2-bin.tar.gz -C ./<br><br>rm -rf apache-hive-3.1.2-bin.tar.gz<br><br>mv  apache-hive-3.1.2-bin hive<br></code></pre></td></tr></table></figure>

<h2 id="3-4-安装-Kafka"><a href="#3-4-安装-Kafka" class="headerlink" title="3.4 安装 Kafka"></a>3.4 安装 Kafka</h2><hr>
<blockquote>
<p><a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/apache/kafka">https://mirrors.tuna.tsinghua.edu.cn/apache/kafka</a></p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs shell">cd /usr/local<br><br>wget https://mirrors.tuna.tsinghua.edu.cn/apache/kafka/2.8.1/kafka_2.12-2.8.1.tgz<br><br>tar -zxvf kafka_2.12-2.8.1.tgz -C ./ <br><br>rm -rf kafka_2.12-2.8.1.tgz<br><br>mv kafka_2.12-2.8.1/ kafka<br></code></pre></td></tr></table></figure>

<h2 id="3-5-安装-Flume"><a href="#3-5-安装-Flume" class="headerlink" title="3.5 安装 Flume"></a>3.5 安装 Flume</h2><hr>
<blockquote>
<p><a target="_blank" rel="noopener" href="https://mirrors.tuna.tsinghua.edu.cn/apache/flume/">https://mirrors.tuna.tsinghua.edu.cn/apache/flume/</a></p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br></pre></td><td class="code"><pre><code class="hljs shell">cd /usr/local<br><br>wget https://mirrors.tuna.tsinghua.edu.cn/apache/flume/1.9.0/apache-flume-1.9.0-bin.tar.gz<br><br>tar -zxvf apache-flume-1.9.0-bin.tar.gz -C ./<br><br>rm -rf apache-flume-1.9.0-bin.tar.gz<br><br>mv apache-flume-1.9.0-bin apache<br></code></pre></td></tr></table></figure>

<h2 id="3-6-保存当前容器为镜像"><a href="#3-6-保存当前容器为镜像" class="headerlink" title="3.6 保存当前容器为镜像"></a>3.6 保存当前容器为镜像</h2><hr>
<blockquote>
<p>由于资源比较大，所以会加载一段时间</p>
</blockquote>
<figure class="highlight shell"><table><tr><td class="gutter"><pre><span class="line">1</span><br></pre></td><td class="code"><pre><code class="hljs shell">sudo docker commit -p pc1 ubuntu/hadoop<br></code></pre></td></tr></table></figure>
<p><img src="https://img-blog.csdnimg.cn/894d5b9dd1d549a18d3640bc3553cac5.png" srcset="/img/loading.gif" lazyload alt="在这里插入图片描述"><br>至此，基于Docker搭建Hadoop集群环境就结束了。</p>

                
              </div>
            
            <hr/>
            <div>
              <div class="post-metas my-3">
  
    <div class="post-meta mr-3 d-flex align-items-center">
      <i class="iconfont icon-category"></i>
      

<span class="category-chains">
  
  
    
      <span class="category-chain">
        
  <a href="/categories/%E5%A4%A7%E6%95%B0%E6%8D%AE/" class="category-chain-item">大数据</a>
  
  

      </span>
    
  
</span>

    </div>
  
  
    <div class="post-meta">
      <i class="iconfont icon-tags"></i>
      
        <a href="/tags/Docker/">#Docker</a>
      
        <a href="/tags/Hadoop/">#Hadoop</a>
      
    </div>
  
</div>


              
  

  <div class="license-box my-3">
    <div class="license-title">
      <div>【Hadoop】基于Docker搭建集群环境</div>
      <div>http://example.com/2021/10/13/【Hadoop】基于Docker搭建集群环境/</div>
    </div>
    <div class="license-meta">
      
        <div class="license-meta-item">
          <div>作者</div>
          <div>John Doe</div>
        </div>
      
      
        <div class="license-meta-item license-meta-date">
          <div>发布于</div>
          <div>2021年10月13日</div>
        </div>
      
      
      <div class="license-meta-item">
        <div>许可协议</div>
        <div>
          
            
            
              <a target="_blank" href="https://creativecommons.org/licenses/by/4.0/">
              <span class="hint--top hint--rounded" aria-label="BY - 署名">
                <i class="iconfont icon-by"></i>
              </span>
              </a>
            
          
        </div>
      </div>
    </div>
    <div class="license-icon iconfont"></div>
  </div>



              
                <div class="post-prevnext my-3">
                  <article class="post-prev col-6">
                    
                    
                      <a href="/2021/10/13/Hadoop%E9%9B%86%E7%BE%A4%E6%90%AD%E5%BB%BA%20_%20%E5%9F%BA%E4%BA%8EDocker%E6%90%AD%E5%BB%BA3%E8%8A%82%E7%82%B9%E7%9A%84Hadoop%E5%AE%8C%E5%85%A8%E5%88%86%E5%B8%83%E5%BC%8F%E9%9B%86%E7%BE%A4/" title="Hadoop集群搭建 _ 基于Docker搭建3节点的Hadoop完全分布式集群">
                        <i class="iconfont icon-arrowleft"></i>
                        <span class="hidden-mobile">Hadoop集群搭建 _ 基于Docker搭建3节点的Hadoop完全分布式集群</span>
                        <span class="visible-mobile">上一篇</span>
                      </a>
                    
                  </article>
                  <article class="post-next col-6">
                    
                    
                      <a href="/2021/10/13/%E3%80%90NoSQL%E5%AE%9E%E6%88%98%E3%80%91%E5%9F%BA%E4%BA%8ENoSQL%E7%9A%84%E8%B4%AD%E7%89%A9%E5%88%86%E6%9E%90%E4%B8%8E%E6%8E%A8%E8%8D%90%E7%B3%BB%E7%BB%9F%20_%20%E5%88%9D%E5%AD%A6%E8%80%85%E8%AF%BE%E8%AE%BE/" title="【NoSQL实战】基于NoSQL的购物分析与推荐系统 _ 初学者课设">
                        <span class="hidden-mobile">【NoSQL实战】基于NoSQL的购物分析与推荐系统 _ 初学者课设</span>
                        <span class="visible-mobile">下一篇</span>
                        <i class="iconfont icon-arrowright"></i>
                      </a>
                    
                  </article>
                </div>
              
            </div>

            
          </article>
        </div>
      </div>
    </div>

    <div class="side-col d-none d-lg-block col-lg-2">
      
  <aside class="sidebar" style="margin-left: -1rem">
    <div id="toc">
  <p class="toc-header"><i class="iconfont icon-list"></i>&nbsp;目录</p>
  <div class="toc-body" id="toc-body"></div>
</div>



  </aside>


    </div>
  </div>
</div>





  



  



  



  



  







    

    
      <a id="scroll-top-button" aria-label="TOP" href="#" role="button">
        <i class="iconfont icon-arrowup" aria-hidden="true"></i>
      </a>
    

    
      <div class="modal fade" id="modalSearch" tabindex="-1" role="dialog" aria-labelledby="ModalLabel"
     aria-hidden="true">
  <div class="modal-dialog modal-dialog-scrollable modal-lg" role="document">
    <div class="modal-content">
      <div class="modal-header text-center">
        <h4 class="modal-title w-100 font-weight-bold">搜索</h4>
        <button type="button" id="local-search-close" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </button>
      </div>
      <div class="modal-body mx-3">
        <div class="md-form mb-5">
          <input type="text" id="local-search-input" class="form-control validate">
          <label data-error="x" data-success="v" for="local-search-input">关键词</label>
        </div>
        <div class="list-group" id="local-search-result"></div>
      </div>
    </div>
  </div>
</div>

    

    
  </main>

  <footer>
    <div class="footer-inner">
  
    <div class="footer-content">
       <a href="https://hexo.io" target="_blank" rel="nofollow noopener"><span>Hexo</span></a> <i class="iconfont icon-love"></i> <a href="https://github.com/fluid-dev/hexo-theme-fluid" target="_blank" rel="nofollow noopener"><span>Fluid</span></a> 
    </div>
  
  
  
  
</div>

  </footer>

  <!-- Scripts -->
  
  <script  src="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.js" ></script>
  <link  rel="stylesheet" href="https://lib.baomitu.com/nprogress/0.2.0/nprogress.min.css" />

  <script>
    NProgress.configure({"showSpinner":false,"trickleSpeed":100})
    NProgress.start()
    window.addEventListener('load', function() {
      NProgress.done();
    })
  </script>


<script  src="https://lib.baomitu.com/jquery/3.6.0/jquery.min.js" ></script>
<script  src="https://lib.baomitu.com/twitter-bootstrap/4.6.1/js/bootstrap.min.js" ></script>
<script  src="/js/events.js" ></script>
<script  src="/js/plugins.js" ></script>


  <script  src="https://lib.baomitu.com/typed.js/2.0.12/typed.min.js" ></script>
  <script>
    (function (window, document) {
      var typing = Fluid.plugins.typing;
      var subtitle = document.getElementById('subtitle');
      if (!subtitle || !typing) {
        return;
      }
      var text = subtitle.getAttribute('data-typed-text');
      
        typing(text);
      
    })(window, document);
  </script>




  
    <script  src="/js/img-lazyload.js" ></script>
  




  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/tocbot/4.18.2/tocbot.min.js', function() {
    var toc = jQuery('#toc');
    if (toc.length === 0 || !window.tocbot) { return; }
    var boardCtn = jQuery('#board-ctn');
    var boardTop = boardCtn.offset().top;

    window.tocbot.init({
      tocSelector     : '#toc-body',
      contentSelector : '.markdown-body',
      headingSelector : CONFIG.toc.headingSelector || 'h1,h2,h3,h4,h5,h6',
      linkClass       : 'tocbot-link',
      activeLinkClass : 'tocbot-active-link',
      listClass       : 'tocbot-list',
      isCollapsedClass: 'tocbot-is-collapsed',
      collapsibleClass: 'tocbot-is-collapsible',
      collapseDepth   : CONFIG.toc.collapseDepth || 0,
      scrollSmooth    : true,
      headingsOffset  : -boardTop
    });
    if (toc.find('.toc-list-item').length > 0) {
      toc.css('visibility', 'visible');
    }
  });
</script>


  <script src=https://lib.baomitu.com/clipboard.js/2.0.10/clipboard.min.js></script>

  <script>Fluid.plugins.codeWidget();</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/anchor-js/4.3.1/anchor.min.js', function() {
    window.anchors.options = {
      placement: CONFIG.anchorjs.placement,
      visible  : CONFIG.anchorjs.visible
    };
    if (CONFIG.anchorjs.icon) {
      window.anchors.options.icon = CONFIG.anchorjs.icon;
    }
    var el = (CONFIG.anchorjs.element || 'h1,h2,h3,h4,h5,h6').split(',');
    var res = [];
    for (var item of el) {
      res.push('.markdown-body > ' + item.trim());
    }
    if (CONFIG.anchorjs.placement === 'left') {
      window.anchors.options.class = 'anchorjs-link-left';
    }
    window.anchors.add(res.join(', '));
  });
</script>


  
<script>
  Fluid.utils.createScript('https://lib.baomitu.com/fancybox/3.5.7/jquery.fancybox.min.js', function() {
    Fluid.plugins.fancyBox();
  });
</script>


  <script>Fluid.plugins.imageCaption();</script>

  <script  src="/js/local-search.js" ></script>





<!-- 主题的启动项，将它保持在最底部 -->
<!-- the boot of the theme, keep it at the bottom -->
<script  src="/js/boot.js" ></script>


  

  <noscript>
    <div class="noscript-warning">博客在允许 JavaScript 运行的环境下浏览效果更佳</div>
  </noscript>
</body>
</html>
